<?php

use Biz\service\springHomeDecActivity\ContentService;

class ContentAction extends ActionPlugin
{
    const USER_LEVEL = self::LEVEL_NOTHING;
    const VALIDATOR_TOAST_DEBUG = true;

    //参数校验-规则
    public const VALIDATOR_RULES = [
        'topic_id' => 'require|integer',
    ];

    //参数校验-自定义消息
    public const VALIDATOR_MSG = [
        'topic_id.require' => '参数错误',
    ];

    public function main()
    {
        $topicId = $this->params['topic_id'] ?? 0;
        $uid = $this->params['uid'] ?? $this->uid;
        $uid = $uid ?: 0;
        $date = \Biz\service\springHomeDecActivity\Util::getContentShowDate();
        $content = ContentService::getTopicContents($uid, $topicId,$date);
        $this->setSuccess($content);
    }
}